package org.common.strategy2.Impl;

import org.common.strategy2.AbstractStrategyFactory;
import org.common.strategy2.Factory2;
import org.springframework.stereotype.Component;

/**
 * @Author: @weixueshi
 * @Create: 2024/7/19 - 21:39
 * @Version: v1.0
 */

/**
 * 微信支付策略
 */
@Component
public class WxPayStrategy2 extends AbstractStrategyFactory {
    @Override
    public void pay(String payType) {
        //具体支付实现逻辑
        System.out.println("微信支付");
    }

    @Override
    public String wxMethod(String payType) {
        System.out.println("微信独有");
        return "微信独有";
    }

    @Override
    public String invokeCommon() {
        return "子父类通用";
    }

    /**
     * 注册微信支付策略方法
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {
        Factory2.register("wxPay",this);
    }
}
